﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPI.Utility;
using KPI.OrganizationDomain.Model.Entity;

namespace KPI.OrganizationDomain.Infrastructure.DbObject
{
    public class EmployeeTab:EntityBase
    {
        public string FirstName;
        public string LastName;
        public DateTime? Birthday;
        public DateTime FirstWorkingDate;

        public int EmployeeID;
        public string LoginName;

        public string Email;
        public string MobilePhoneNumber;
        public string TelephoneNumber;
        public int EmployeeLevelID;
        public int EmployeeTitleID;
        
        public EmployeeTab()
        { }
      
        public  EmployeeTab(Employee employeeDto)
        {
            this.FirstName = employeeDto.FirstName;
            this.LastName = employeeDto.LastName;
            this.Birthday = employeeDto.Birthday;
            this.FirstWorkingDate = employeeDto.FirstWorkingDate;
            this.EmployeeID = employeeDto.EmployeeID;
            this.LoginName = employeeDto.LoginName;
            this.Email = employeeDto.Email;
            this.MobilePhoneNumber = employeeDto.MobilePhoneNumber;
            this.TelephoneNumber = employeeDto.TelephoneNumber;

            this.LastModifiedDate = employeeDto.LastModifiedDate;
            this.Version = employeeDto.Version;
            this.IsDeleted = employeeDto.IsDeleted;
            this.CreatedDate = employeeDto.CreatedDate;
            this.EmployeeLevelID = employeeDto.Level.EmployeeLevelID;
            this.EmployeeTitleID = employeeDto.Title.EmployeeTitleID;
        }

        public static Employee FillEmployee(EmployeeTab employeeTab, Employee employee)
        {
            employee.EmployeeID = employeeTab.EmployeeID;
            return employeeTab.Copy<Employee>(employee);
        }

    }
}
